package com.itboye.pondteam.pondteam;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.pondteam.R;
import com.itboye.pondteam.app.MyApplication;
import com.itboye.pondteam.base.BaseActivity;
import com.itboye.pondteam.custom.ActivityInputWifiAndPass;
import com.itboye.pondteam.custom.RatioImageView;


/**
 * Created by Mr.w on 2017/3/4.
 * 此界面为通用界面
 */

public class ActivityStepFirst extends BaseActivity {
    TextView txt_title;
    ImageView img_back, img_right;
    Button btn_next;
    RatioImageView img;
    String type = "";
    int position;

    MyApplication app;

    public static ActivityStepFirst instance;

    public static ActivityStepFirst getInstance() {
        return instance;
    }

    public static void setInstance(ActivityStepFirst instance) {
        ActivityStepFirst.instance = instance;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_device_step1);
        instance = this;
        app = (MyApplication) getApplication();
        app.addDeviceFirst = this;
        txt_title.setText("添加" + getIntent().getStringExtra("device_type"));
        type = getIntent().getStringExtra("device_type");
        position = getIntent().getIntExtra("position", 0);
        switch (position) {
            case 0:
                img.setBackgroundResource(R.drawable.add_shuizu);
                break;
            case 1:
                img.setBackgroundResource(R.drawable.add_shuizu);
                break;
            case 2:
                img.setBackgroundResource(R.drawable.add_shuizu);
                break;
            case 3:
                img.setBackgroundResource(R.drawable.add_pongdteam);
                break;
            case 4:
                break;
            case 5:
                img.setBackgroundResource(R.drawable.add_jiarebang);
                break;
            case 6:
                img.setBackgroundResource(R.drawable.add_pongdteam);
                break;
            case 7:
                break;
            case 8:
                img.setBackgroundResource(R.drawable.add_pongdteam);
                break;
        }
        if (type != null) {
            if (type.equals("摄像头")) {
                img.setBackgroundResource(R.drawable.shexiangtou);
            } else if (type.equals("AQ")) {
                img.setBackgroundResource(R.drawable.aq);
            }
        }
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()) {
            case R.id.img_back:
                finish();
                break;
            case R.id.btn_next:
                intent = new Intent(this, ActivityInputWifiAndPass.class);
                intent.putExtra("device_type", getIntent().getStringExtra("device_type"));
                intent.putExtra("position", position);
                startActivity(intent);
                break;
        }
    }
}
